﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="CloseAccountPeriod.aspx.cs" Inherits="KPIS.GERP.GAMS.APP.App_UI.Forms.CloseAccountPeriod" %>
<%@ Register src="../UserControls/DatePicker.ascx" tagname="DatePicker" tagprefix="uc1" %>
<asp:Content ID="Content2" runat="server" contentplaceholderid="head">
    <title>ปิดงวดบัญชี</title>
    <link href="../CssClass.css" rel="stylesheet" type="text/css" />
    <script language="JavaScript" src="../Scripts/DatePicker.js" type="text/jscript"></script>
</asp:Content>
<asp:Content ID="Body" runat="server" contentplaceholderid="ContentPlaceHolder1" >
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="txtBgmYear">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="txtBgmYear" 
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="grd1" 
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="grd1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="grd1" 
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            </AjaxSettings>
    </telerik:RadAjaxManager>

    <div class="DivHeader">
        ปิดงวดบัญชี
    </div>

    <div class="DivBody">
        <table>
            <tr>
                <td width="150px">
                    ปิดงวดประจำปีงบประมาณ : 
                </td>
                <td>
                    <telerik:RadNumericTextBox ID="txtBgmYear" runat="server" MaxLength="4">
                        <NumberFormat DecimalDigits="0" GroupSeparator="" />
                    </telerik:RadNumericTextBox>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <asp:Label ID="lblError1" runat="server" ForeColor="Red" Font-Bold="true"></asp:Label>
                    <asp:Button ID="cmdCalculate" runat="server" Text="สร้างข้อมูลปิดงวดบัญชี" OnClick="cmdCalculate_Click" />
                </td>
            </tr>
        </table>
    </div>

    <telerik:RadGrid ID="grd1" runat="server" AutoGenerateColumns="false"
        AllowMultiRowEdit="false" AllowMultiRowSelection="false" ShowStatusBar="false"
        Height="500px"
        Width="998px" AllowPaging="false" AllowFilteringByColumn="true"
        GroupingSettings-GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;"
        GroupingSettings-GroupContinuedFormatString=""
        GroupingSettings-GroupContinuesFormatString=""
        GroupingSettings-GroupSplitFormat=""
        OnDetailTableDataBind="grd1_DetailTableDataBind">
        <MasterTableView AllowMultiColumnSorting="True" CellSpacing="-1" GroupLoadMode="Client" Width="100%"
            DataKeyNames="tran_seq" NoMasterRecordsText="< ไม่มีข้อมูล >" GroupsDefaultExpanded="true">
            <DetailTables>
                <telerik:GridTableView Width="100%" runat="server" ShowFooter="true" AllowPaging="false" AllowFilteringByColumn="false"
                    Caption="รายละเอียด" DataKeyNames="tran_dtls_seq">
                    <Columns>
                        <telerik:GridBoundColumn DataField="tran_dtls_seq" UniqueName="tran_dtls_seq" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="account_seq" UniqueName="account_seq" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="dr_or_cr" Visible="false"
                            HeaderText="เดบิต/เครดิต" UniqueName="dr_or_cr"
                            FilterControlWidth="100%" AutoPostBackOnFilter="true"
                            CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="100px"
                            HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="account_code" 
                            HeaderText="รหัสบัญชี" UniqueName="account_code" 
                            FilterControlWidth="100%" AutoPostBackOnFilter="true"
                            CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="150px"
                            HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="account_name" 
                            HeaderText="ชื่อบัญชี" UniqueName="account_name" 
                            FilterControlWidth="100%" AutoPostBackOnFilter="true"
                            CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                            HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center"
                            FooterStyle-HorizontalAlign="Right"
                            FooterText="รวม :">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="debit_amount" Aggregate="Sum"
                            HeaderText="Dr" UniqueName="debit_amount" DataFormatString="{0:n2}"
                            FilterControlWidth="100%" AutoPostBackOnFilter="true"
                            CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                            HeaderStyle-Width="150px" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center"
                            ItemStyle-HorizontalAlign="Right"
                            FooterStyle-HorizontalAlign="Right">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="credit_amount" Aggregate="Sum"
                            HeaderText="Cr" UniqueName="credit_amount" DataFormatString="{0:n2}"
                            FilterControlWidth="100%" AutoPostBackOnFilter="true"
                            CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                            HeaderStyle-Width="150px" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center"
                            ItemStyle-HorizontalAlign="Right"
                            FooterStyle-HorizontalAlign="Right">
                        </telerik:GridBoundColumn>
                    </Columns>
                </telerik:GridTableView>
            </DetailTables>
            <Columns>
                <telerik:GridBoundColumn DataField="bgm_year" UniqueName="bgm_year" Visible="false">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="record_status" UniqueName="record_status" Visible="false">
                </telerik:GridBoundColumn>
                
                <telerik:GridBoundColumn DataField="ref_type" 
                    HeaderText="ref_type" UniqueName="ref_type"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true" 
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" Visible="false" 
                    HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ref_seq" 
                    HeaderText="ref_seq" UniqueName="ref_seq"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true" 
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" Visible="false" >
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="tran_seq" 
                    HeaderText="tran_seq" UniqueName="tran_seq"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true" 
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" Visible="false">
                </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="tran_type" 
                    HeaderText="tran_type" UniqueName="tran_type"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true" 
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" Visible="false">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="work_area_seq" 
                    HeaderText="work_area_seq" UniqueName="work_area_seq"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true" 
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" Visible="false">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="bgm_source_seq" 
                    HeaderText="bgm_source_seq" UniqueName="bgm_source_seq"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true" 
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" Visible="false">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ref_no" Visible="false"
                    HeaderText="เลขที่อ้างอิง" UniqueName="ref_no"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true"
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                    HeaderStyle-Width="100px" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="bgm_source_name" 
                    HeaderText="bgm_source_name" UniqueName="bgm_source_name"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true"
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                    HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center"
                    HeaderStyle-Width="150px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="tran_date" DataFormatString = "{0:D}"
                    HeaderText="วันที่ทำรายการ" UniqueName="tran_date"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true"
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                    HeaderStyle-Width="120px" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="tran_name" 
                    HeaderText="ชื่อรายการ" UniqueName="tran_name"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true"
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                    HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="remarks"  Visible="false"
                    HeaderText="หมายเหตุ" UniqueName="remarks"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true"
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                    HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center"
                    HeaderStyle-Width="150px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="record_status_name"  Visible="false"
                    HeaderText="สถานะ" UniqueName="record_status_name"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true"
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                    HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center"
                    HeaderStyle-Width="100px">
                </telerik:GridBoundColumn>
            </Columns>
            <PagerStyle Mode="NumericPages" AlwaysVisible="true" 
                FirstPageToolTip="กลับหน้าแรก" LastPageToolTip="ไปหน้าสุดท้าย" 
                NextPagesToolTip="หน้าถัดไป" NextPageToolTip="หน้าถัดไป" 
                PrevPagesToolTip="ย้อนกลับ" PrevPageToolTip="ย้อนกลับ" />
        </MasterTableView>
        <GroupingSettings GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;" 
            GroupContinuedFormatString="" GroupContinuesFormatString="" 
            GroupSplitFormat="" />
        <ClientSettings EnableRowHoverStyle="True" EnablePostBackOnRowClick="false">
            <Selecting AllowRowSelect="false" />
            <Scrolling AllowScroll="true" UseStaticHeaders="true" />
        </ClientSettings>
    </telerik:RadGrid>

    <div class="DivBody">
        <table>
            <tr>
                <td width="150px">
                </td>
                <td>
                    <asp:Label ID="lblError2" runat="server" ForeColor="Red" Font-Bold="true"></asp:Label>
                    <asp:Button ID="cmdSave" runat="server" Text="บันทึกการปิดงวดบัญชี" OnClick="cmdSave_Click"/>
                </td>
            </tr>
        </table>
    </div>

    <%--<div class="DivHeader">
        ยอดยกไป
    </div>

    <telerik:RadGrid ID="grd2" runat="server" AutoGenerateColumns="false"
        AllowMultiRowEdit="false" AllowMultiRowSelection="false" ShowStatusBar="false"
        Height="500px"
        Width="998px" AllowPaging="false" AllowFilteringByColumn="true"
        GroupingSettings-GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;"
        GroupingSettings-GroupContinuedFormatString=""
        GroupingSettings-GroupContinuesFormatString=""
        GroupingSettings-GroupSplitFormat=""
        OnDetailTableDataBind="grd2_DetailTableDataBind">
        <MasterTableView AllowMultiColumnSorting="True" CellSpacing="-1" GroupLoadMode="Client" Width="100%"
            DataKeyNames="tran_seq" NoMasterRecordsText="< ไม่มีข้อมูล >" GroupsDefaultExpanded="true">
            <DetailTables>
                <telerik:GridTableView Width="100%" runat="server" ShowFooter="true" AllowPaging="false" AllowFilteringByColumn="false"
                    Caption="รายละเอียด" DataKeyNames="tran_dtls_seq">
                    <Columns>
                        <telerik:GridBoundColumn DataField="tran_dtls_seq" UniqueName="tran_dtls_seq" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="account_seq" UniqueName="account_seq" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="dr_or_cr" Visible="false"
                            HeaderText="เดบิต/เครดิต" UniqueName="dr_or_cr"
                            FilterControlWidth="100%" AutoPostBackOnFilter="true"
                            CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="100px"
                            HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="account_code" 
                            HeaderText="รหัสบัญชี" UniqueName="account_code" 
                            FilterControlWidth="100%" AutoPostBackOnFilter="true"
                            CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="150px"
                            HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="account_name" 
                            HeaderText="ชื่อบัญชี" UniqueName="account_name" 
                            FilterControlWidth="100%" AutoPostBackOnFilter="true"
                            CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                            HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center"
                            FooterStyle-HorizontalAlign="Right"
                            FooterText="รวม :">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="debit_amount" Aggregate="Sum"
                            HeaderText="Dr" UniqueName="debit_amount" DataFormatString="{0:n2}"
                            FilterControlWidth="100%" AutoPostBackOnFilter="true"
                            CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                            HeaderStyle-Width="150px" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center"
                            ItemStyle-HorizontalAlign="Right"
                            FooterStyle-HorizontalAlign="Right">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="credit_amount" Aggregate="Sum"
                            HeaderText="Cr" UniqueName="credit_amount" DataFormatString="{0:n2}"
                            FilterControlWidth="100%" AutoPostBackOnFilter="true"
                            CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                            HeaderStyle-Width="150px" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center"
                            ItemStyle-HorizontalAlign="Right"
                            FooterStyle-HorizontalAlign="Right">
                        </telerik:GridBoundColumn>
                    </Columns>
                </telerik:GridTableView>
            </DetailTables>
            <Columns>
                <telerik:GridBoundColumn DataField="bgm_year" UniqueName="bgm_year" Visible="false">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="record_status" UniqueName="record_status" Visible="false">
                </telerik:GridBoundColumn>
                
                <telerik:GridBoundColumn DataField="ref_type" 
                    HeaderText="ref_type" UniqueName="ref_type"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true" 
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" Visible="false" 
                    HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ref_seq" 
                    HeaderText="ref_seq" UniqueName="ref_seq"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true" 
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" Visible="false" >
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="tran_seq" 
                    HeaderText="tran_seq" UniqueName="tran_seq"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true" 
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" Visible="false">
                </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="tran_type" 
                    HeaderText="tran_type" UniqueName="tran_type"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true" 
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" Visible="false">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="work_area_seq" 
                    HeaderText="work_area_seq" UniqueName="work_area_seq"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true" 
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" Visible="false">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="bgm_source_seq" 
                    HeaderText="bgm_source_seq" UniqueName="bgm_source_seq"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true" 
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" Visible="false">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ref_no" 
                    HeaderText="เลขที่อ้างอิง" UniqueName="ref_no"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true"
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                    HeaderStyle-Width="100px" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="tran_date" DataFormatString = "{0:D}"
                    HeaderText="วันที่ทำรายการ" UniqueName="tran_date"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true"
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                    HeaderStyle-Width="120px" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="tran_name" 
                    HeaderText="ชื่อรายการ" UniqueName="tran_name"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true"
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                    HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="remarks" 
                    HeaderText="หมายเหตุ" UniqueName="remarks"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true"
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                    HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center"
                    HeaderStyle-Width="150px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="record_status_name" 
                    HeaderText="สถานะ" UniqueName="record_status_name"
                    FilterControlWidth="100%" AutoPostBackOnFilter="true"
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                    HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center"
                    HeaderStyle-Width="100px">
                </telerik:GridBoundColumn>
            </Columns>
            <PagerStyle Mode="NumericPages" AlwaysVisible="true" 
                FirstPageToolTip="กลับหน้าแรก" LastPageToolTip="ไปหน้าสุดท้าย" 
                NextPagesToolTip="หน้าถัดไป" NextPageToolTip="หน้าถัดไป" 
                PrevPagesToolTip="ย้อนกลับ" PrevPageToolTip="ย้อนกลับ" />
        </MasterTableView>
        <GroupingSettings GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;" 
            GroupContinuedFormatString="" GroupContinuesFormatString="" 
            GroupSplitFormat="" />
        <ClientSettings EnableRowHoverStyle="True" EnablePostBackOnRowClick="false">
            <Selecting AllowRowSelect="false" />
            <Scrolling AllowScroll="false" UseStaticHeaders="false" />
        </ClientSettings>
    </telerik:RadGrid>--%>

    <%--<div class="DivBody">
        <table>
            <tr>
                <td width="150px">
                </td>
                <td>
                    <asp:Label ID="lblError3" runat="server" ForeColor="Red" Font-Bold="true"></asp:Label>
                    <asp:Button ID="cmdSave2" runat="server" Text="บันทึกยอดยกไป" OnClick="cmdSave2_Click"/>
                </td>
            </tr>
        </table>
    </div>--%>

</asp:Content>
